using Microsoft.EntityFrameworkCore;
using NLog.Web;
using Web.API.BLL;
using Web.API.DAL;
using Web.API.IBLL;
using Web.API.IDAL;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddDbContext<MyContext>(x =>
{
    x.UseSqlServer(builder.Configuration.GetConnectionString("conn"));
});
builder.Services.AddScoped(typeof(UserIDAL<>),typeof(UserDAL<>));
builder.Services.AddScoped<UserIBLL,UserBLL>();
builder.Services.AddScoped<StaffIBLL,StaffBll>();
builder.Host.UseNLog();
var app = builder.Build();

app.UseCors(x=>x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();
app.UseStaticFiles();
app.Run();
